Crispo - Excel Challenge 06 2025

excel-challenges
weekly-exercises
Easy Sunday Excel Challenge
Published

February 9, 2025

Illustration for Crispo - Excel Challenge 06 2025

Challenge Description

Easy Sunday Excel Challenge

⭐ Summary ⭐Create the Detailed table from the Summary

Solutions

library(tidyverse)
library(readxl)

path = "files/Ex-Challenge 06 2025.xlsx"
input = read_excel(path, range = "B3:D6")
test  = read_excel(path, range = "F3:H14")

result = input %>%
  separate(SNo., into = c("start", "end"), sep = "-", fill = "right", convert = TRUE) %>%
  mutate(SNo. = map2(start, coalesce(end, start), seq)) %>%
  unnest(SNo.) %>%
  select(SNo., Sport, Day)

all.equal(result, test)
#> [1] TRUE
  • Logic:

    • Reads the workbook range needed for the challenge

    • Builds the intermediate helper columns that drive the final answer

  • Strengths:

    • The R solution stays compact and mirrors the workbook logic closely.
  • Areas for Improvement:

    • The code assumes the workbook layout and named ranges remain stable.
  • Gem:

    • The best part of the solution is choosing a tidy intermediate shape before producing the final answer.
import pandas as pd

path = "files/Ex-Challenge 06 2025.xlsx"
input = pd.read_excel(path, usecols="B:D", skiprows=2, nrows=3)
test = pd.read_excel(path, usecols="F:H", skiprows=2, nrows=12).rename(columns=lambda x: x.replace('.1', ''))

input[['start', 'end']] = input['SNo.'].str.split('-', expand=True)
input['start'] = input['start'].fillna(input['SNo.'])
input['end'] = input['end'].fillna(input['SNo.'])

input['start'] = input['start'].fillna(0).astype(int)
input['end'] = input['end'].fillna(input['start']).astype(int)

input['SNo.'] = input.apply(lambda row: list(range(row['start'], row['end']+1)), axis=1)

input = input.explode('SNo.')
result = input[['SNo.', 'Sport', 'Day']].reset_index(drop=True)
result['SNo.'] = result['SNo.'].astype('int64')

print(result.equals(test)) # True
  • Logic:

    • Reads the workbook range needed for the challenge
  • Strengths:

    • The Python version keeps the same rule in a direct pandas-oriented workflow.
  • Areas for Improvement:

    • As with the R version, any workbook layout change would require small adjustments.
  • Gem:

    • The implementation stays close to the stated challenge instead of adding unnecessary complexity.

Difficulty Level

This task is easy to moderate:

  • The business rule is readable, but the workbook still needs a few careful transformation steps.